package cvut.cz.via.android;

import cvut.cz.via.android.adapters.SettingsListAdapter;

import android.app.ListActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ListView;

public class SettingsActivity extends ListActivity {
	
	private StudyMaterialsApplication sma;
	private SettingsListAdapter adapter;
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.settings_activity);
        sma = getStudyMaterialsApplication();
        Log.d("USER_SETTINGS", sma.user.getUserSettings().toString());
        adapter = new SettingsListAdapter(sma.user.getUserSettings(), this);
        setListAdapter(adapter);
    }
	
	private StudyMaterialsApplication getStudyMaterialsApplication() {
		StudyMaterialsApplication sma = (StudyMaterialsApplication)getApplication();
		return sma;
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		// TODO Auto-generated method stub
		super.onListItemClick(l, v, position, id);
		adapter.toggleItem(position);
	}
	
	

}
